import WeekDay.WeekDay

object EnumerDemo {
  def main(args: Array[String]): Unit = {
//    val monday:WeekDay = WeekDay.Monday
    //////    println(monday)
    ////    val sunday = WeekDay.withName("Sunday")
    ////    println(sunday)
    ////    println(sunday.id)
//    println(WeekDay.maxId)
//    println(WeekDay(0))
    println(isWeekend(WeekDay.Sunday))
  }

  def isWeekend(wd:WeekDay.Value):Boolean = {
    wd match {
      case WeekDay.Saturday => true
      case WeekDay.Sunday => true
      case _ => false
    }
  }

}

//定义枚举一
//object WeekDay extends Enumeration {
//  type WeekDay = Value
//  val Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday = Value
//}

//定义枚举二
object WeekDay extends Enumeration {
  type WeekDay = Value
  val Monday = Value("Monday")
  val Tuesday = Value("Tuesday")
  val Wednesday = Value("Wednesday")
  val Thursday = Value("Thursday")
  val Friday = Value("Friday")
  val Saturday = Value("Saturday")
  val Sunday = Value("Sunday")
}